import React from "react";
import { changeWether } from "./../redux/actions/about.js";
import { connect } from "react-redux";
class About extends React.Component {
  render() {
    let { wether, changeWether } = this.props;
    return (
      <>
        今天的天气是{wether}
        <button
          onClick={() => {
            changeWether(wether);
          }}
        >
          改变天气
        </button>
      </>
    );
  }
}

function mapStateToProps(state) {
  console.log("mapStateToProps", state);
  return {
    wether: state.about.wether,
  };
}
function mapDispatchToProps(dispatch) {
  console.log("mapDispatchToProps");
  return {
    changeWether: function (data) {
      dispatch(changeWether(data));
    },
  };
}
export default connect(mapStateToProps, mapDispatchToProps)(About);
